package diyiti;

public class student {
    String sex;
    String name;
    int age;

    public student() {
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        if(name.equals("男")|name.equals("女"))
        { this.name = name;}
        else {throw  new SexException("性别异常");

        }

    }

    public int getAge(int i) {
        return age;
    }

    public void setAge(int age) {
        if(age>=15&age<=50){this.age = age;}else {throw new AgeException("年龄异常");}

    }

    public student(String sex, String name, int age) {
        this.sex = sex;
        this.name = name;
        this.age = age;
    }
}
